package br.com.hermes.emu.bt.task;

import br.com.hermes.bt.HmBluetoothDevice;
import br.com.hermes.bt.HmClient;
import br.com.hermes.bt.HmException;
import br.com.hermes.bt.HmHandle;
import br.com.hermes.emu.bt.EmuClient;

public class EmuClientTask extends EmuTask{
  private HmClient hmClient;
	private HmBluetoothDevice device;
	
	public EmuClientTask(HmHandle handle, HmBluetoothDevice device, int what) {
		super(handle, what);
		this.hmClient = new EmuClient();
		this.device   = device;
	}
	
	@Override
	public void run() {
		try {
			if (hmClient.connect(device)) {
				dispatchMessage(hmClient.getHmStream());
			}
		} catch (HmException e) {

		}
	}
}
